package com.mew.common.enm;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 代理配置 类型
 */
public enum AgentConfigType {

    ExtractLevel (1, "代理提取分红限制等级"),
    ProxiedLevelReward(2, "下线VIP等级达成奖励"),
    TaxBonus(3,"税收分红比例"),
    BuyDiscount(4,"充值折扣"),
    SysSellDiscount(5,"系统贩卖折扣"),
    BindExp(6,"绑定经验"),
    BuyExp(7,"购买经验"),
    LevelHasExp(8,"升级所需经验"),
    BindReward(9,"绑定赠送"),
    ;

    private final static Map<Integer, AgentConfigType> stateMap
            = Arrays.stream(AgentConfigType.values()).collect(Collectors.toMap(AgentConfigType::code, code -> code));

    private final int code;
    private final String desc;


    AgentConfigType(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return this.code;
    }

    public String desc() {
        return this.desc;
    }

    public static AgentConfigType parse(int code) {
        return stateMap.get(code);
    }

}
